home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 27.zip / BS1 part 27 / ImageMaster_d3.adf / piarc.lzh.parta / eroder.rexx < prev    next >
OS/2 REXX Batch file  |  1993-03-23  |  2KB  |  95 lines

  1. /*
  2.  * ERODER.rexx   ( calls the erode command )
  3.  *
  4.  *  Written by: Barry Chalmers and Ben Williams
  5.  * Last Update: January 17th, 1992
  6.  *    Revision: 1.01
  7.  *         For: Black Belt Systems image processing series IM, IM F/c, and IP.
  8.  */
  9. call pragma('stack',20000);
  10.  
  11. /*
  12.  * open rexxsupport.library -- needed for some functions
  13.  */
  14. if ~show('L',"rexxsupport.library") then do
  15.   if addlib('rexxsupport.library',0,-30,0) then do
  16.       /* everything's ok */
  17.     end;
  18.   else do
  19.     say 'We Have A Library Problem, Unable To Load "rexxsupport.library"';
  20.     say 'Cannot operate this module without the library - sorry!';
  21.     exit 10;
  22.     end;
  23.   end;
  24.  
  25. prtnme = 'IP_Port'; /* assume Image Professional */
  26. if show('P','IP_Port') = 0 then do
  27.   if show('P','IM_Port') = 0 then do
  28.     say "Can't find image processor's ARexx port!!!"; /* not running? */
  29.     say "This script requires IP, IM or IM F/c to run!";
  30.     exit(20);
  31.     end;
  32.   else do
  33.     prtnme = 'IM_Port';
  34.     end;
  35.   end;
  36. address(prtnme);
  37.  
  38.   /*
  39.    * This code attempts to read a file called "picmdpath" from REXX:
  40.    * If it can't find it, the script will assume that the commands
  41.    * associated with this PI Module are in "c:". If the file exists,
  42.    * the script will look in the path that is specified in the file.
  43.    * If you create this file, you MUST put a complete, correct path
  44.    * in it; if the commands are in a sub-directory, you have to put
  45.    * the trailing slash on the path (like, device:dir/).
  46.    * 
  47.    */
  48.   cmdpath = 'c:';
  49.   if open(fhandle,'rexx:picmdpath','read') then  /* open the file */
  50.     do
  51.       cmdpath = readln(fhandle);
  52.       call close(fhandle);  /* close the file    */
  53.     end
  54.  
  55. 'tofront';
  56.  
  57. options results;
  58. 'gadgets "Brightness Erode","","Brightness Dilate",""';
  59. emode = result-1;
  60. options;
  61. if emode < 0 then do
  62.   address;
  63.   exit 0;
  64.   end
  65.  
  66.  
  67. 'fchide';
  68. options results;
  69. 'askprop "Cell size:" 6 2 20';
  70. edge = result;
  71. options;
  72.  
  73. 'fcshow';
  74. 'backuptoundo';
  75. 'area';
  76.  
  77. options results;
  78. 'jackin';
  79. jack = result;
  80. 'current';
  81. bufdata = result;
  82. options;
  83. parse var bufdata bname ',' bnum ',' brest
  84.  
  85. 'lockimage '||bnum;
  86. address command cmdpath||'erode '||jack||' '||edge||' '||emode;
  87. 'unlockimage '||bnum;
  88. address(prtnme);
  89.  
  90. 'redraw';
  91.  
  92. address;
  93.  
  94. exit 0;
  95.